package mapper;

import Message.DTO.SetmealPageQueryDTO;
import Message.entity.Setmeal;
import Message.vo.SetmealVO;
import anno.AutoFill;
import com.github.pagehelper.Page;
import enumeration.OperationType;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealMapper {




    Page<SetmealVO> SelectPage(SetmealPageQueryDTO setmealPageQueryDTO);

    Setmeal SelectByid(Long id);

    void Delete(List<Long> ids);


    @AutoFill(OperationType.INSERT)
    @Options(useGeneratedKeys = true, keyProperty = "id")   //获取主键id值
    @Insert("insert into setmeal values (null, #{categoryId}, #{name}, #{price},  #{status}, #{description}, #{image}, " +
            "#{createTime}, #{updateTime}, #{createUser}, #{updateUser})")
    void insert(Setmeal setmeal);

    @AutoFill(OperationType.UPDATE)
    void update(Setmeal setmeal);

    List<SetmealVO> List(Long categoryId);
}
